package com.dl.study.module.user.controller;

import com.dl.study.log.anno.OperationLogAnnotation;
import com.dl.study.log.enums.OperationType;
import com.dl.study.log.enums.OperationUnit;
import com.dl.study.module.swagger.SwaggerTagConst;
import com.dl.study.module.user.domain.dto.UserQueryListDto;
import com.dl.study.module.user.service.ProductService;
import com.dl.study.util.resp.ResponseDTO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: user
 * @Date: 2021/8/30 16:42
 * @Description:
 */
@RestController
@Api(value = "用户控制类", tags = SwaggerTagConst.Consumer.USER_MANAGE_CONFIG, description = "用户模型控制类描述")
public class ConsumerController {
    @Autowired
    private ProductService productService;

    @GetMapping("/invoke/{id}")
    public String invokeProduct(@PathVariable("id") Integer id) {
        String result = productService.products(21);
        return "调用用户服务成功.....调用商品服务结果：{}" + result;
    }

    @PostMapping("/user/add/")
    @OperationLogAnnotation(operModul = "test", level = 1, operType = OperationType.INSERT, operationUnit = OperationUnit.USER)
    public ResponseDTO<Object> add(@RequestBody UserQueryListDto userQueryListDto) {
        return productService.add(userQueryListDto);
    }

}
